<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href="favicon.ico" rel="shortcut icon" />

<title>注册会员</title>
<meta name="description" content="" />
<meta name="keywords" content="世界杯" />
<link type="text/css" rel="stylesheet" href="/assets/base/jiujiajiu/css/style.css">
<link type="text/css" rel="stylesheet" href="/assets/base/jiujiajiu/css/notice.css">
<script type="text/javascript" src="/assets/base/jiujiajiu/js/jquery.min.js"></script>
<script type="text/javascript" src="/assets/base/jiujiajiu/js/notice.js"></script>
<script type="text/javascript" src="/assets/base/jiujiajiu/js/date.js"></script>
<script type="text/javascript" src="/assets/base/jiujiajiu/js/support.js"></script>
</head>
<body>
<div>
	<div class="mainlogo_zhc">
		<img src="/assets/base/jiujiajiu/images/logo.png">
	</div>
	<div class="pw">
		<section class="body_main">
			<!--内容开始-->
			<div id="todayList">
				<!--显示相册名称+说明-->
				<ul class="chatPanel">
					<li class="media">
						<div class="def_list_1">
							<table width="100%" border="0" align="center" valign="top" cellpadding="0" cellspacing="0">
								<tr>
									<td align="center" ><a href="{BEESCRM::U('Base/Jiujiajiu/register',array('wechat_id'=>$wechat_id))}">注册会员</a>
									</td>
									<td width="1" style="border-right: 1px #ddd solid"></td>
									<td align="center" class="active02"><a href="{BEESCRM::U('Base/Jiujiajiu/binding',array('wechat_id'=>$wechat_id))}">会员绑定</a></td>
								</tr>
							</table>
						</div>
						<div class="clear"></div>
						<form name=form1>
							<table width="100%" border="0" cellspacing="0" cellpadding="0" class="zchy">
								<tr>
									<th width="27%">姓&nbsp;&nbsp;&nbsp;名：</th>
									<td width="73%"><input type="text" class="mrinput" id='username'>
									</td>
								</tr>
								<tr>
									<th>生&nbsp;&nbsp;&nbsp;日：</th>
									<td>
										<select name="YYYY" id="year" onchange="YYYYMM(this.value)" style="display:none;">
										</select> 
										<select name="MM" id="month" onchange="MMDD(this.value)">
										</select> 
										<select name="DD" id="day">
											<option selected='selected'>日</option>
										</select>
									</td>
								</tr>
								<tr>
									<th>性&nbsp;&nbsp;&nbsp;别：</th>
									<td>
										<input type="radio" name="sex" id="radio"  value='1'>男
										<input type="radio" name="sex" id="radio"  value='2'>女
									</td>
								</tr>
								<tr>
									<th>手&nbsp;&nbsp;&nbsp;机：</th>
									<td><input type="text" class="mrinput" id="tel"></td>
								</tr>
								<tr>
									<th>验证码：</th>
									<td>
										<input type="text" class="mrinput" style="width: 60px" id='verify'>
										<a href="javascript:void(0)" onclick='getCode()'>获取验证码</a>
									</td>
								</tr>
								<!-- <tr>
									<th>介绍人：</th>
									<td><input type="text" class="mrinput" id='invite' placeholder='（选填）'></td>
								</tr> -->
							</table>
						</form>
						<div class="clear"></div>
					</li>
				</ul>
			</div>
			<!--内容结束-->
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td align="center">
						<input class="mrbtn" value="注册会员" type="submit" onclick='register()' id='submit'/>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" align="center"></td>
				</tr>
				<!-- <tr>
					<td colspan="2" align="center"><h4>还不是会员？现在注册即可领取惊喜大礼！</h4></td>
				</tr> -->
				<tr>
					<td colspan="2" align="center">&nbsp;</td>
				</tr>
			</table>
		</section>
	</div>
	<div class="body_footer">客服热线400-888-9979</div>
</div>
</div>
	<script type='text/javascript'>
		function register(){
			$('#submit').attr('onclick','');
			var username=$('#username').val();
			var year=1900/* $('#year').val() */;
			var month=$('#month').val();
			var day=$('#day').val();
			var sex=$("input[name='sex']:checked").val();
			var tel=$('#tel').val();
			var verify=$('#verify').val(); 
			/* var invite=$('#invite').val(); */
			var verify_method=/1[3-8]+\d{9}/;
			if(username==''){
				infotips('请输入姓名',$('.submit_tips'));
			}else if(year=='年' || month=='月' || day=='日'){
				infotips('请选择生日日期',$('.submit_tips'));
			}else if(typeof(sex)=='undefined'){
				infotips('请选择性别',$('.submit_tips'));
			}else if(!verify_method.test(tel)){
				infotips('请输入正确的手机号',$('.submit_tips'));
			}else if(verify==''){
				infotips('请输入验证码',$('.submit_tips'));
			}else{
				if(month.length==1){
					month='0'+month;
				}
				if(day.length==1){
					day='0'+day;
				}
				$.ajax({
					type:'post',
					dataType:'post',
					data:{'username':username,'year':year,'month':month,'day':day,'sex':sex,'tel':tel,'verify':verify},
					url:"{BEESCRM::U('Base/Jiujiajiu/doRegister',array('wechat_id'=>$wechat_id))}",
					complete:function(data){					//此处jQuery无法解析json,所以采用complete人工解析
						var json=eval("("+data.responseText+")");
						if(json.status=='S'){
							infotips(json.message,$('.submit_tips'),'right');
							setTimeout("location.href='{BEESCRM::U('Base/Jiujiajiu/card',array('wechat_id'=>$wechat_id))}'",2000);
						}else{
							infotips(json.message,$('.submit_tips'));
						}
					}
				});
			}
			$('#submit').attr('onclick','register()');
		}
		
		function getCode(){
			var verify=/1[3-8]+\d{9}/;
			var tel=$('#tel').val();
			if(verify.test(tel)){
				$.ajax({
					type:'post',
					dataType:'post',
					data:{'tel':tel},
					url:"{BEESCRM::U('Base/Jiujiajiu/getCode',array('wechat_id'=>$wechat_id))}",
					complete:function(data){					//此处jQuery无法解析json,所以采用complete人工解析
						var json=eval("("+data.responseText+")");
						if(json.status=='S'){
							infotips(json.message,$('.submit_tips'),'right');
						}else{
							infotips(json.message,$('.submit_tips'));
						}
					}
				});
			}else{
				infotips('请输入正确的手机号',$('.submit_tips'));
			}
		}
	</script>
</body>
</html>